<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
	<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
	<link rel="stylesheet" href="../../static/css/ylb.css">
	<link rel="shortcut icon" href="../../static/img/logo.png">
	<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
	<script type="text/javascript" src="../../static/js/popper.min.js"></script>
	<script type="text/javascript" src="../../static/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../../static/js/qrcode.min.js"></script>
	<script type="text/javascript" src="./config.js"></script>
	<style>
	
    /* 选中样式 */
    .usergroup_selected {
        color: rgb(59,94,225);
        background: rgba(59,94,225,0.1);
        cursor: pointer;
        padding: 5px 12px;
        border-radius: 100px;
        font-size: 14px;
        margin-right: 6px;
        margin-bottom: 10px;
        float: left;
    }

    /* 未选中样式 */
    .unselected {
        background-color: #eee;
        color: #666;
        cursor: pointer;
        padding: 5px 12px;
        border-radius: 100px;
        font-size: 14px;
        margin-right: 6px;
        margin-bottom: 10px;
        float: left;
    }
  </style>
</head>
<body>
<div id="app">
	<!-- 左侧 -->
	<div class="left">
		<script src="../../static/fontawesomev5/js/all.min.js" data-auto-replace-svg="nest"></script>
		<style>
			* {
				margin: 0;
				padding: 0;
				list-style: none;
			}
			.logo {
				width: 170px;
				height: 55px;
				margin-top: 20px;
				margin-bottom: 20px;
				background-size: 100% 100%;
                background-image: url('../../static/img/index_logo.png');
            	background-position: center;
            	background-size: 90%;
            	background-repeat: no-repeat;
			}
			.menu-box {
				padding-left: 15px;
				padding-right: 15px;
				font-family: SourceHanSansSC-regular;
				border-top: 1px solid #fff;
				max-height: 100vh;
				background: #fff;
				width: 200px;
				/* overflow-y: auto; */
			}
			.menu {
				background-color: #fff;
				border-right: 1px solid #e6e6e6;
				list-style: none;
				position: relative;
				margin: 0;
				padding-left: 0;
				text-align: left;
				width: 170px;
				border-right: 1px solid #fff;
				height: 100%;
			}
			.sub-menu {
				background-color: #fff;
				border-right: 1px solid #e6e6e6;
				list-style: none;
				position: relative;
				margin: 0;
				padding-left: 0;
				text-align: left;
				width: 100%;
				border-right: 1px solid #fff;

			}

			.menu>ul {
				display: flex;
				flex-direction: column;
			}
			.menuitem {
				font-size: 14px;
				/*padding: 0 20px;*/
				cursor: pointer;
				position: relative;
				color: #303133;
				-webkit-transition: border-color .3s, background-color .3s, color .3s;
				transition: border-color .3s, background-color .3s, color .3s;
				-webkit-box-sizing: border-box;
				box-sizing: border-box;
				white-space: nowrap;
				margin-top: 6px;
				margin-bottom: 6px;
				border-radius: 10px;
				user-select: none;
				line-height: 40px;
				padding-left: 20px;
			}
			.menu_selected {
				color: rgb(61, 126, 255) !important;
				background-color: #e4edff !important;
			}
			.menu_hover {
				background-color: #e0e8f7 !important;
			}
			.sub-menu .menuitem a {
				/*padding-left: 20px;*/
			}
			.menu>ul>li>ul {
				display: none;
			}
			.padding {
				width: 5px;
				height: 5px;
				display: inline-block
			}
			.up {
				transform: rotateZ(180deg);
				display: inline-block;
			}
			.arrow {
				transition: all 0.5s;
				color: #999999;
			}
			.menu_selected a {
				color: rgb(61, 126, 255) !important;
			}
			.menuitem a {
				color: #303133;
				display: inline-block;
				width: 100%;
			}
			.menuitem a:hover {
				text-decoration: none;
			}
		</style>
		<div class="menu-box">
			<a href="../index/" class="index">
				<div class="logo"></div>
			</a>
			<ul class="menu">
				<li class="menuitem "><a href="../index/"><i class="fas fa-home fa-lg"></i> <i
							class="padding"></i>统计概况</a></li>
				<li class="menuitem"><i class="fas fa-link fa-lg"> </i> <i class="padding"></i>外链管理 <span
						class="arrow"><i class="fa fa-chevron-down fa-xs"></i></span>
					<ul class="sub-menu">
						<li class="menuitem menu_selected"><a href="../jumpWeiXin/">创建链接</a></li>
						<li class="menuitem1xs"></li>
						<li class="menuitem2xs"></li>
					</ul>
				</li>
				<li class="menuitem"><i class="fas fa-qrcode fa-lg"> </i> <i class="padding"></i> 活码管理 <span
						class="arrow up"><i class="fa fa-chevron-down fa-xs"></i></span>
					<ul class="sub-menu">
						<li class="menuitem "><a href="../qun/">群活码</a></li>
						<li class="menuitem "><a href="../kf/">客服码</a></li>
						<li class="menuitem "><a href="../channel/">渠道码</a></li>
					</ul>
				</li>
				<li class="menuitem"><i class="fas fa-shopping-bag fa-lg"> </i> <i class="padding"></i> <a
						href="../tbk/">淘宝客管理</a></li>
				<li class="menuitem"><i class="fas fa-share-alt fa-lg"> </i> <i class="padding"></i> <a
						href="../dwz/">短网址管理</a></li>
				<li class="menuitem"><i class="fas fa-file-image fa-lg"> </i> <i class="padding"></i> <a
						href="../sucai/">素材管理</a></li>
				<li class="menuitem"><i class="fas fa-shopping-bag fa-lg"> </i> <i class="padding"></i> 系统设置
					<span class="arrow up"><i class="fa fa-chevron-down fa-xs"></i></span>
					<ul class="sub-menu">
						<li class="menuitem "><a href="../user/">会员管理</a></li>
						<li class="menuitem "><a href="../config/">域名管理</a></li>
						<!--<li class="menuitem "><a href="../config/yy_config.php"  >配置中心</a></li>-->
						<li class="menuitem "><a href="../plugin/">插件中心</a></li>
						<!--<li class="menuitem "><a href="../upload/"  >在线更新</a></li>-->
					</ul>
				</li>
			</ul>
		</div>
		<div class="account" id="accountInfo"></div>
		<script>
			$(function() {
				// 为菜单添加点击事件处理程序，以展开或折叠子菜单
				$('.menu > li').click(function() {
					$(this).find('ul').slideToggle();
					$(this).find("span").toggleClass("up");
					console.log($(this).find("span"))
					event.stopPropagation();
				});
				$('.sub-menu > li').click(function() {
					event.stopPropagation();
				});
				$('.sub-menu > li').hover(function(event) {
					$(this).addClass("menu_hover")
					event.stopPropagation();
					// 当鼠标指针进入 #element 时，执行此处的代码
				}, function(event) {
					$(this).removeClass("menu_hover")
					event.stopPropagation();
					// 当鼠标指针离开 #element 时，执行此处的代码
				});
				init();
			});
			//为菜单添加默认折叠
			function init() {
				$('.menu > li:eq(1)').find("ul").hide();
				$('.menu > li:eq(2)').find("ul").hide();
			}
		</script>
	</div>

	<!-- 右侧 -->
	<div id="right">
	    
		<h3>配置中心</h3>
		<div class="data-card">
		    
			<!-- 按钮区域 -->
			<div class="button-view" id="button-view" style="display:none;">
			    
				<button class="default-btn" 
				        data-toggle="modal" 
				        data-target="#addDomainNameModal" 
				        onclick="initialize_addDomainName();">添加域名
				</button>
				<button class="tint-btn" 
				        data-toggle="modal" 
				        data-target="#domainNameCheckConfigModal" 
				        style="margin-left: 5px;"
				        onclick="getDomainNameCheckConfigInfo();">域名检测
				</button>
				<a href="notification.html"><button class="tint-btn" style="margin-left: 5px;">通知渠道</button></a>
			</div>
			
			<!-- 列表区域 -->
			<div class="data-list">
			    
				<table class="table">
				    <thead></thead>
				    <tbody></tbody>
				</table>
			</div><!-- data-list -->
			
			<p class="loading" style="display: none;"></p>
			
			<!-- 分页 -->
			<div class="fenye"></div>
			
		</div><!-- data-card -->
	</div><!-- right -->

	<!-- 添加域名 -->
    <div class="modal fade" id="addDomainNameModal">
        <div class="modal-dialog">
            <div class="modal-content">
                
                    <!-- 头部 -->
                    <div class="modal-header">
                        <h4 class="modal-title">添加域名</h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div><!-- modal-header -->
                    
                    <!-- 表单 -->
                    <div class="modal-body">
                        <form id="addDomainName">
                        <span class="text">域名</span>
                        <input type="text" name="domain" class="form-control" id="domain" autocomplete="off" placeholder="填写域名（ http:// 或 https:// 开头）">
                        
                        <span class="text">域名类型</span>
                        <select name="domain_type" class="form-control" id="domain_type">
                            <option value="">选择域名类型</option>
                            <option value="1">入口域名</option>
                            <option value="2">落地域名</option>
                            <option value="3">短链域名</option>
                            <option value="4" title="应用场景：域名被封就启用备用域名">备用域名</option>
                            <option value="5" title="例如阿里云OSS，腾讯云COS">对象存储域名</option>
                        </select>
                        </form>
                    </div><!-- modal-body -->
                    
                    <!-- 底部操作 -->
                    <div class="modal-footer">
                        <div class="footer-btn">
                        <div class="faqnav" title="阅读使用指南">
                            <span class="faq"><a href="../faq.php?faq=config" target="_blank">?</a></span>
                        </div>
                        <div class="btnnav">
                            <button type="button" class="default-btn" onclick="addDomainName();">立即添加</button>
                        </div>
                    </div>
                    
                </div><!-- modal-footer -->
                
                <!-- 操作反馈 -->
                <div class="result"></div>
                
            </div><!-- modal-content -->
        </div><!-- modal-dialog -->
    </div><!-- addDomainNameModal -->
    
    <!-- 添加授权用户组 -->
    <div class="modal fade" id="addUsergroupModal">
        <div class="modal-dialog">
            <div class="modal-content">
                
                    <div class="modal-header">
                        <h4 class="modal-title">添加授权用户组</h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>
                    
                    <div class="modal-body">
                        <span class="text" style="margin-bottom: 10px;">选择一个或多个用户组</span>
                        <span id="selectedTags"></span>
                        <span id="availableTags"></span>
                        <input type="hidden" class="newUsergroupArray" />
                        <input type="hidden" class="domain_id" />
                    </div>
                    
                    <div class="modal-footer">
                        <div class="footer-btn">
                        <div class="faqnav" title="阅读使用指南">
                            <span class="faq"><a href="../faq.php?faq=config" target="_blank">?</a></span>
                        </div>
                        <div class="btnnav">
                            <button type="button" class="default-btn" onclick="setUsergroup()">立即添加</button>
                        </div>
                    </div>
                </div>
                <div class="result"></div>
            </div>
        </div>
    </div><!-- addDomainNameModal -->
    
    <!-- 域名检测 -->
    <div class="modal fade" id="domainNameCheckConfigModal">
        <div class="modal-dialog">
            <div class="modal-content">
                
                    <!-- 头部 -->
                    <div class="modal-header">
                        <h4 class="modal-title">域名检测</h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div><!-- modal-header -->
                    
                    <!-- 表单 -->
                    <div class="modal-body">
                        <form id="editDomainNameCheckConfig">
                            
                            <span class="text">开启状态</span>
                            <select name="domainCheck_status" class="form-control" id="domainCheck_status"></select>
                            
                            <span class="text">通知渠道</span>
                            <select name="domainCheck_channel" class="form-control" id="domainCheck_channel" title="检测到落地域名被拦截将给你发送通知"></select>
                            
                            <span class="text">备用域名</span>
                            <select name="domainCheck_byym" class="form-control" id="domainCheck_byym" title="检测到落地域名被拦截将会跳转到此域名">
                            </select>
                        </form>
                    </div><!-- modal-body -->
                    
                    <!-- 底部操作 -->
                    <div class="modal-footer">
                        <div class="footer-btn">
                        <div class="faqnav" title="阅读使用指南">
                            <span class="faq"><a href="../faq.php?faq=config" target="_blank">?</a></span>
                        </div>
                        <div class="btnnav">
                            <button type="button" class="default-btn" onclick="editDomainNameCheckConfig();">提交设置</button>
                        </div>
                    </div>
                </div><!-- modal-footer -->
                
                <!-- 操作反馈 -->
                <div class="result"></div>
                
            </div><!-- modal-content -->
        </div><!-- modal-dialog -->
    </div><!-- defaultDomainNameModal -->
  	
  	<!-- 确定删除域名 -->
    <div class="modal fade" id="DelDomainModal">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                
                <!-- 头部 -->
                <div class="modal-header">
                    <h4 class="modal-title">删除域名</h4>
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                </div><!-- modal-header -->
                
                <!-- 内容 -->
                <div class="modal-body">
                    已创建的活码只要不删除域名解释不影响使用！
                </div><!-- modal-body -->
                
                <!-- 底部操作 -->
                <div class="modal-footer"></div><!-- modal-footer -->
                
                <!-- 操作反馈 -->
                <div class="result"></div>
                
            </div><!-- modal-content -->
        </div><!-- modal-dialog -->
    </div><!-- DelDomainModal -->

    <!-- 全局信息提示框 -->
    <div id="notification">
        <div id="notification-text"></div>
    </div>
    
</div><!-- app -->


<script type="text/javascript">

// 上传客服二维码
$("#uploadKfQrcode").change(function(e){
    
    // 获取选择的文件
    var fileSelect = e.target.files;
    if(fileSelect.length>0){
        
        // file表单数据
        var imageData = new FormData(document.getElementById("editQun"));
        
        // 异步上传
        $.ajax({
            url:"../upload.php",
            type:"POST",
            data:imageData,
            cache: false,
            processData: false,
            contentType: false,
            success: function(res) {
                
                if(res.code == 200){
                    
                    // 上传成功
                    $('#qun_kf_edit').val(res.url);
                    $('#EditQunHm .modal-body .upload_kf').css('display','none');
                    $('#EditQunHm .modal-body .wxqrcode_preview').css('display','block');
                    $('#EditQunHm .modal-body .wxqrcode_preview').html('<img src="'+res.url+'" class="wxqrcode" /><p class="uploadSuccess">上传成功</p>');
                }else{
                    
                    // 上传失败
                    $('#uploadKfQrcode').val('');
                    showErrorResult(res.msg)
                }
                
            },
            error: function() {
                
                // 上传失败
                showErrorResult('服务器发生错误！可按F12打开开发者工具点击Network或网络查看返回信息进行排查！')
            }
        })
    }
})

// 上传群二维码（上传子码）
$("#uploadZmQrcode").change(function(e){
    
    // 获取选择的文件
    var fileSelect = e.target.files;
    if(fileSelect.length>0){
        
        // file表单数据
        var imageData = new FormData(document.getElementById("uploadZmQrcodeForm"));
        // qun_id
        var qun_id = $("#uploadZmQrcode_qun_id").val();
        
        // 异步上传
        $.ajax({
            url:"./uploadZmQrcode.php",
            type:"POST",
            data:imageData,
            cache: false,
            processData: false,
            contentType: false,
            success: function(res) {
                
                if(res.code == 200){
                    
                    // 上传成功
                    // 刷新子码列表
                    freshenQunZmList(qun_id)
                }else{
                    
                    // 上传失败
                    showErrorResult(res.msg)
                }
                
            },
            error: function() {
                
                // 上传失败
                showErrorResult('服务器发生错误！可按F12打开开发者工具点击Network或网络查看返回信息进行排查！')
            }
        })
    }
})

// 上传群二维码（更换子码）
$("#updateZmQrcode").change(function(e){
    
    // 获取选择的文件
    var fileSelect = e.target.files;
    if(fileSelect.length>0){
        
        // file表单数据
        var imageData = new FormData(document.getElementById("editQunzm"));
        
        // 异步上传
        $.ajax({
            url:"../upload.php",
            type:"POST",
            data:imageData,
            cache: false,
            processData: false,
            contentType: false,
            success: function(res) {
                
                if(res.code == 200){
                    
                    // 上传成功
                    $('#zm_qrcode_edit').val(res.url);
                    $('#EditQunZm .modal-body .upload_qun').css('display','none');
                    $('#EditQunZm .modal-body .qunqrcode_preview').css('display','block');
                    $('#EditQunZm .modal-body .qunqrcode_preview').html('<img src="'+res.url+'" class="qunqrcode" /><p class="uploadSuccess">上传成功</p>');
                    
                }else{
                    
                    // 上传失败
                    showErrorResult(res.msg)
                    // 清空file选择的文件以重试
                    $("#updateZmQrcode").val('');
                }
                
            },
            error: function() {
                
                // 上传失败
                showErrorResult('服务器发生错误！可按F12打开开发者工具点击Network或网络查看返回信息进行排查！')
                // 清空file选择的文件以重试
                $("#updateZmQrcode").val('');
            }
        })
    }
})

</script>


</body>
</html>